-- TAO TABLE

--TAO BANG KHACHHANG
CREATE TABLE KHACHHANG
(
	MAKH NVARCHAR(15),
	TEN NVARCHAR(15),
	DCHI NVARCHAR(50),
	DTHOAI NVARCHAR(12),
	CONSTRAINT PK_KH PRIMARY KEY (MAKH)
)
GO
--TAO BANG NHANVIEN
CREATE TABLE NHANVIEN
(
	MANV NVARCHAR(15),
	TEN NVARCHAR(15),
	DCHI NVARCHAR(50),
	DTHOAI NVARCHAR(12),
	LUONG FLOAT,
	LOAINV BIT,
	CONSTRAINT PK_NV PRIMARY KEY (MANV)
)
GO
--TAO BANG LOAIMB
CREATE TABLE LOAIMB
(
	MALOAI NVARCHAR(15),
	HANGSX NVARCHAR(15),
	CONSTRAINT PK_LMB PRIMARY KEY (MALOAI)
)
GO
--TAO BANG MAYBAY
CREATE TABLE MAYBAY
(
	SOHIEU INT,
	MALOAI NVARCHAR(15),
	CONSTRAINT PK_MB PRIMARY KEY (SOHIEU,MALOAI)
)
GO
--TAO BANG CHUYENBAY
CREATE TABLE CHUYENBAY
(
	MACB NVARCHAR(4),
	SBDI NVARCHAR(3),
	SBDEN NVARCHAR(3),
	GIODI DATETIME,
	GIODEN DATETIME,
	CONSTRAINT PK_CB PRIMARY KEY (MACB)
)
GO
--TAO BANG LICHBAY
CREATE TABLE LICHBAY
(
	NGAYDI DATETIME,
	MACB NVARCHAR(4),
	SOHIEU INT,
	MALOAI NVARCHAR(15),
	CONSTRAINT PK_LB PRIMARY KEY (NGAYDI,MACB)
)
GO
--TAO BANG DATCHO
CREATE TABLE DATCHO
(
	MAKH NVARCHAR(15),
	NGAYDI DATETIME,
	MACB NVARCHAR(4),
	CONSTRAINT PK_DC PRIMARY KEY (MAKH,NGAYDI,MACB)
)
GO
--TAO BANG KHANANG
CREATE TABLE KHANANG
(
	MANV NVARCHAR(15),
	MALOAI NVARCHAR(15),
	CONSTRAINT PK_KN PRIMARY KEY (MANV,MALOAI)
)
GO
--TAO BANG PHANCONG
CREATE TABLE PHANCONG
(
	MANV NVARCHAR(15),
	NGAYDI DATETIME,
	MACB NVARCHAR(4)
	CONSTRAINT PK_PC PRIMARY KEY (MANV,NGAYDI,MACB)
)